from tkinter import *
from lxg_tkinter import demos, Quitter


class Demo(Frame):
    def __init__(self, parent=None, **options):
        Frame.__init__(self, parent, **options)
        self.pack()
        self.tools()
        Label(self, text="多选框Demo").pack()
        self.vars = []
        for k in demos:
            var = IntVar()
            Checkbutton(self, text=k, variable=var,
                        command=demos[k]).pack(side=LEFT)
            self.vars.append(var)

    def report(self):
        for v in self.vars:
            print(v.get(), end=' ')
        print()

    def tools(self):
        frm = Frame()
        frm.pack(side=RIGHT)
        Button(frm, text='状态', command=self.report).pack(fill=X)
        Quitter(frm).pack(fill=X)


if __name__ == '__main__':
    Demo().mainloop()
